implemented write