A little refactoring and addressed defects.
Merge branch 'daniel_2073' into daniel_2087