Moves 2 test functions to a helpers file
Refactors all code