added push_function_scope to stop functions from clobbering each other's memory