made some nasty try/catch statements to reduce the problem of entering illegal moves.