Some refactorings in $view and more tests