From http://mattduvall.com/peeler.js/