add tests
view refactoring