Added a global array to make it all work