Updated naming & improved Javascript implementation