Pull request for issues #46 and #47.