Refactoring: exported more functions to be tested