Cleanup codes

* Replace `var` with  `val`
* Remove redundant variable type declaration
* Remove redundant `return`
* Remove redundant semicolon
* Others