Import trentm's restdown, version 1.3.2.