Added reference handling