Fixing Issue #45 and unit Tests