initial js implementation