removed redundancy in exception handling in main