Refs #7931. Clean up and documenting code.