Removed some unused and commented out code.
Refactoring to remove cycles.