unit tests fixed, clean up

unit tests of main view fixed.
minor clean up.