adding js implementation