Remove unnecessary references to $db variable