Refactoring
Moved functions out of classes
looptest now much more step-by-step, useful for testing individual blocks of code