Minor code refactor in views