completed tester, merge some code and clean code