fixup internal reference labling to make code more readable
extract reference() method to make it extensible