Refactored to reduce duplication - rename the function signatures for payloads and middlewares to ensure a generic macro can be written to load the functions from both. Fixed a bug in the mamalistenc example app.