rearranged JS