massive cleanup
merge better tests and stuff
more reliable references, only 2 references are needed though
stripped down all but db
merge whatever just came in