refactor: put shared puload code into its own function