Moving helper functions to their own file