Added unchecked exception handling in main