Refactor decoder state and updates