A mostly finished database thing

this was a whole lot of work, thx