Made it Python 2 compatible; added arrow key support