replaced System.exit() with throwing IllegalArgumentException outside main