Doing: wrap the function into class; finish server part; not working yet