Fixed issue #10 and issue #4
Fixed issue #11