2nd pass, based on @alandipert's gist

https://gist.github.com/alandipert/334f773ab55a9aee6aa0