Added flush functionality