Updated with write functionality