refactor in views