Refactor test routines into own file