refactor and start working on the forking history along with serialization of history