Little re-organisation of the JS