fixing up the code and adding a ipa hook script