gmc: structred the code