Allow case insensitive answers to instructions

This patch also reduces code duplication and considers EOFError (C-d or
^D) exceptions whilst waiting for raw_input() to return.