big overhaul towards online db, compiles, doesn't work