Improve code coverage
Refactor flushing context