Stefan Dösinger wrote:
There are other things too which could be moved, but I'm not sure if that would make the code more readable. One big function which does things step by step vs a few smaller functions which disturbs the readflow.
All of this code pasted 3 times could probably benefit from some loops over an index. Without knowing anything about the code - typically big if statements are candidates for a sub-function (if (normal))....