Simplify the codes.

[ENH] Simplify the codes.