Added exceptions and handling; Removed exit(0)