small code cleaning
added selective history entry removal