bunch of refactoring, introduction of daos, hopefully everything is still fine