Refactored server.rb