Moved helper functions to separate files