refactored Unmarshal