Modification. Version 1.

According to the comments, rewrite some code and style.