Move settings code from server into settings