More refining on histiry and making parser a reusable function