moved utility code to /lib, fixed bugs with package.json detection