#86 Improving JS structure