lots of changes and a few to db handler