Added function references and ref variables