tested all the methods and fixed some bugs