Added comments to explain TitleCase more, restructured code for clarity.