significant refactors, database