added more unit tests and removed commented out legacy code