Changed coding style and delete unnecessary code