Refactored the way variables are declared in functions.