Improved code

* Fixed some issues
* Fixed standard violation