refactor, start of db implementation