Fixed some CS and removed some unused variables
Merge branch 'master' into 2.2