Merge "Remove unused local variables, update formatting and documentation"