Added flush functions in controllers