Updated code documentation

Removed unused variables, updated code documentation