fixed several functions to use "return" instead of "exit"