Refactored server to be better ordered.