Unused Variables

Removed other unused variables.
Changed to calculating the value when passing it as param