Revised the code according to the feedback of the community.