I refactored the code to use the database class