moved helper functions into perl modules