updated to use available variables. refactored for include of variables.