Updated `migrate` logic