* Made some code more robust
* Scoping of classes
* Code formatting