change type switch to a type assertion
add Unmarshal func

Add function to support unmarshalling without using a Decoder.
Merge branch 'feature-unmarshal'