big switch for writes