Here we have changed just 4 lines to fetch the costs from the database.