refactored and updated variable names