Multiple changes:
- split code into regions
- added class, function and property discriptions
- renamed some properties to make it more clear what they're used for
- fixed some minor code formatting consistancy