I know it is not scientific literature, but look at the first answer.
http://programmers.stackexchange.com/questions/195989/is-it-ok-to-split-long-functions-and-methods-into-smaller-ones-even-though-they

Imho, you do different things.  Even the functions being called only once. It also harder to test `wfr(..)`, due to the fact that each one of the array creation algorithms could be wrong. If you split into functions, and test each function separately, it is easier to see where errors occur.

A small reminder from software perspective, functions are not only created to avoid code reuse, they also allow you to organize your code in a better way.

Other than that, the pull request is ok. Although I would add a small comment indicating that there is a to-do inside the function, as right now the output of `wfr(...)` isn't ready yet.