Added constraint checking to database and better error handling for dbInterface