Add removing unreachable rules
Add clearing up procedures