reconstruct the js code and encapsulate most of interaction with backend into member and dict object, replace most of the global functions.