Remove unused variables, add doc blocks and break lines

Fix #7166