Refactored helper funtions to seperate class and tests in seperate class