Refactor DB and stuff