forked from: forked from: forked from: Ported from http://actionsnippet.com/?p=2820

