Understand the Algorithm

If you don't know how the algorithm works your code will reflect that and will be confusing just as you are confused about the algorithm. A solution to fix this is refactor the code into easy to digest steps so it is clear what each step is and does.

bj 2019-09-22