Pathogen compatible version of https://gist.github.com/joshmattvander/1184058