minor alteration to js structure