Refactor Engine and Main for Socket Server
Little cleanup