base lines for server end code, not finished yet