isPackage() method was edited for more performance.