Merge zwant's changes

merging changes from zwant