made some globals to make this work