Ste/Joe - Organise js code