Better way of detecting package installed or not