some modifications for the recognition loop