Issue 349

The new version is added wth tests. This refers to Issue #349.