Improve error handling, eliminate decoding map