Moved massive lable determination chunk into function..