Added: updated implementation for js version
Changed: Ruby method names. Added: more js version implementation.