Merge pull request #13 from cristi-badila/master

Refactorings and error handling