Refactored file and test file