Moved references to top of code