Heuristic pruning

The version which was working on monday(no swap)