Done (but without a custom type) as previously there was zero error-checking at all.