removed more reference to the databse from the sql