add YReference to represent references from ycp and bunch of fixes