debugged the browser javascript, next implement the rest of the protocol