Some variables have to stay global...
Yet again, making output clear for anybody not familiar with the code...