Functions no longer access global variables; wrap vars together.