updated the original post with the code.

---