Ending main implementation