Refactored ics writer