Clean codes

* Cleaned codes to follow coding style
* Remove some warnings