Refactoring & improvements.
Merge pull request #1 from pasku/master

Refactoring & improvements.