Could we perhaps make this a class or module variable so we're not creating it every time? I think it'll also make the function more readable.