Merging changes from issue#122 branch.