Merge pull request #39 from agg23/master

Fixed issue #34 and issue #38
Fixed issue #42