updating code to add more handling of database objects