fixing winning conditions, adding JavaDoc