better view handling and flush.

Change-Id: Iabe8e1e6aff8bf58fe463f6dfe61da38b84c392d