db cleanups etc
Simplified and cleaned