refactored server setup