Added iCalendar support.

iCalendar support was added.
Some code was cleaned up.
A few minor bugs were fixed.