Added writing of attributes.