fixed bug clashing of variable names create confusion in code