Rewrote to make creating the ICS file more secure.