Fix Issue 22

This PR address issue #22 and also included PR #23