Minor js organisation changes