Refactor

organize the server side code
Missing license header