move test functionality into main program