renamed tester and move all code in main to tester