ReWrote Database class and updated classes to work with new db class