beginning some refactoring of overall server code