Simplified the main program