added z variable to foo()