Fixbug and make code more readable.