I don't think this should override the db value that is passed into the function.  Maybe do the db check only if nothing is passed in?