Replaced EXIT() with return to fix valgrind reports