Reduce the code of display main