DB stuff
Major restructuring, delete some old/irrelevant stuff