Refactor views, fix test