JS style fixes

function/variable name changes + counters are more sensible