rework for recent client changes; some DB cleanup as well
more reorg & cleanup
Merge branch 'dev'