decoder: reader refactoring