greed game after refactoring