Migrating more of the functions file