Exception handling in Database, some other changes