server code refactored
minor updates
code refactored