some refactoring
Merge branch 'master' into gh-pages
avoid repetition and conclude game