Improved functionality to add reference