Replacing new_scope and new_function by begin_scope and begin_function