Adding support for payload validation

Closes #379