Added tester and fixed small bugs