Continued moving functions to the top outside of the mapping function