nested the exit for first condition check