Bugfix and refactoring
Merge pull request #4 from ikusalic/master

Bugfix