fix code style and remove unused codes