Added more tests and testable code