Merge pull request #112 from mchf/master

Ported and refactored patch from Code-11-SP2