Refactor/cleanup of server.go and server_test.go

[#75728000]