I am totally great with moving this to a separate file - i was just trying to make as little waves as possible since big changes were being frowned upon. As for getting the dom elements, i don't see any problem with doing it in this compact, performant way.