change exit to return - we're a function now