Modified main view to allow conditional flush