Improvements and bug fixes.
Merge branch 'DW_master'