started JavaScript implementation