Initial import from gists with a few changes