Global variables, everything works now.