legal move function seems to be functional, needs testing