Extracted common functions into helpers.
Moved functions for testing now extracted helper functions into a separate helper function test file.