Changed the way input is read to support special keys