added more unit tests and removed unnecessary code