using exit instead of return