Cleaned up the main method