rework for recent client changes; some DB cleanup as well
more reorg & cleanup