code refine for data response to web client