Made the payload an actual function (so that checks can be made for function errors at compilation time)