Toyed around with method of ensuring that input is not taken when window is not in focus.