filter 'alternate screen' sequence +refactoring