cleaned up code, added comments, sanitization and readied for VIP review
Merge pull request #1 from Postmedia/vip_review

cleaned up code, added comments, sanitization and readied for VIP review