Added screen grab functionality to key press fucntion