Highjack some goodies from @pengwynn