Finished db component refactoring. Code is now pretty..ish.