Refactoring code and adding back previous tests that are needed in the project.