Code cleanup for the `examples` subproject

* Added parenthises for those functions which have side effects
* Removed unused imports
* Removed unused variables
* Removed unnecceserary parenthises
* Used `val` whenever possible