Added JS implementation (focus on this)