improve code for mmc.c