Refactoring in decoder