Refactorizing decoding method