Refactored server.rb by extracting functionality from get blocks into methods