Cleaned up ical parse function