Refactored response decoding