corrected incorrect parameter
adding the 'detach' method to allow for query cleanup