Remove redundant usage of the $db varaiable