refactored server.rb