viewhook refactor