Merge pull request #29 from ap4y/master

Set of improvements and fixes #1