migrated js to separate file