Moving the NotFound exception to the right place and adding the unless condition.