merge functions and delete old files