Refactoring source.

+ Stronger encapsulation through getters/setters and more private variables.
+ Better commented source-code.
+ Few fixes through if()-checks.

- Untested so far.