reformatted + added exception in main