Implemented a line counter for the handler and pobabilistic replacement rules.