Implement ccgbMain and mcgbRandMain