removing unused function and refactoring tests for readability