added some tests and removed unnecessary code