refactoring (placing variables in functions)