Add missing flushes
Refactor