Merge pull request #1 from antoneri/master

Some refactoring