4: Support references 

Check that different instances of the same template return their own
referenced objects.
4: Support references 

Removed duplicated code