refactored function variables