JS code reformatted