mv var to top of function to be consistent with style in rest of file