add new code and demo code for server