almost implemented all of the tests