Refactor references

This isn't as big of an improvement as I first hoped, but I think it does make the code a bit more clear.

What do you think, @xaviershay?