added flushPage function