perfected migration script