replaced all System.exit() with return