Merge pull request #114 from wkpark/fixup_reference_label

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