adds test for refactored function.