Changing the JS order to solve a dependency problem