Fixed support for references and removing references
Some improvements to versions