Improving changes from pull-request #8