Moved helper functions into their own module