added selection of preferable moves
some refactoring
some refactoring
Merge branch 'master' into gardner
some refactoring