Implemented issue #21 and #20