add the code making client js
some bugs still remain