Added check for illegal moves

Not currently working so needs to be checked.