new code for unit testing, refactoring function names