Clarify code by using named function instead of anonymous function

Should make testing a little bit easier, too.