rearranged javascript, no changes