add chain recognition.. under construction