finished refactoring view generation