modified gistfile from mike