Refactoring server code and added integration w/ major parts.