Fixed Issue #11
Added comments, refactored a little, and used codeblocks AStyle reformatter
Merge branch 'master' into development (acciendently got ahead of dev)