Updated comments and removed any unused variables and redundant code
Merge branch 'mark'