Commenting, prototyping, and various fixes.