Fix history order
remove some dead code