added pause when window looses focus