updated proc function to exit at false