added new tool to view state of database, added extra checks on db functions