Use a work dir instead of a temp dir
Added reflash command; refactored errors, setup...