Moving most code to `server` package