Improved the database access