Issue #34: Step six implementation. Debugging complete. Updated comments. Removed unnecessary print statements.