Add a reference name analyzer

Still needs lots of tests and a few getters and setters implemented...