Attached patch moves functions out of the huge libpayload.h into headers