Fixed a bunch of referencing errors