gist https://gist.github.com/nolanlawson/65301812d14abc1eaccf