adds a way to win at the end; bugfixes