Keeping it in a function would be fine; just saying that the implementation could be simplified.