Don't need to globalize $db. Just store it in $this->db