Originally Posted by xpi0t0s
The code is not difficult to follow and it is hard to see how it could be simplified further. What part(s) are you struggling to understand?
Also you forgot to state what the problem was, i.e. the issue you're trying to solve.
It does not look good but you also did not gave a title which would be helpful