Removed redundant code in main method