rewriting the part with isFlush