moves are done

The moves function correctly and return a correct set of moves.It is
still done in a very inefficient way.