Merged issues #38 and #39