Refactored pukkeyToScript for clarity