using global var mousePos

I know, I need to remove it.