refactored, changed variable names