Clamp the number of iterations
Remove some INLINEs
Fix function call
Formatting