Added counter writing.