Changed creating a new database object in each class to using the global $db variable to avoid multiple connections