Added enhancements for issues #20 and #2