Merge https://gist.github.com/5363306
Created as a new project repository, merged from gist akivajp/5363306