Merge pull request #1 from lorien/master

Backporting
some basic refactoring done
little improvement
typos
fixed mutable arguments
few simple fixes
Applyed pull request #63: readability