Added history writing