- removed missed code duplicity
- some minor traded safety for speed were made (safety should be higher level responsobility, conditioning in core API is unwanted)
- refactoring conditioning to switches
- using 16bit uint instead of 32bit int for iterations (same precision, iteration is non negative)

current solution speed:
- 0.582911

2nd best solution (other):
- 0.691895