[code] put the migraiton loop back in php, add js observers