made change for code review feedback: add variable at top