refactored so that variables more accurately reflect their purpose