Add more detail to unmarshalling errors
Moved to module
Added flag to show error detail