Why create a function outside the view when you can create it as part of the view?