Implemented getPath method to make code more testable