I am merging issue #131 and PR #132 into this PR. The changes in #132 became obsolete due to the changes in this branch. However, this simple modification fixed it. Closes #131
Now the working version of it :P