modified the whole source code,fixed some code style problems.