Nearly finished changing references for globals. Still need to add struct parameter to function calls.