variables should be declared at the top of the function