Stream parser refactoring