Added writing functions.