Removed two trivial helper functions
Modified the old file to use foldM