Some code cleanup and a few comment additions as well.