Enhance 'ref' function so that it can access JSON elements which are
loaded other functions.