Added write functionality