Re-written with codex
Merge pull request #711 from abhinavc/master

Re-written with codex