Forked from original gist

This was originally a gist: https://gist.github.com/ericminikel/7572758/