Non-fork version of #168