Refactored enhancing algorithm.

The enhancing algorithm is now independent of main greedy algorithm.