major update on restructure the database access