migration and cleanup