restructuring the database creating class