re-written
Merge pull request #687 from abhinavc/master

rewritten 2/25h/d2go4