Added new Library for helper functions and refactored code to make use of helper script