Made the code testable