Small refactor for more idomatic Scala