added counter and updated end game