Refactored server methods code