re-organize js file