rework due to new variable names and logic