code from gh-pages brought over