Merge pull request #3 from ikusalic/master

Bugfix
Bugfix and refactoring