Implemented a rerun mechanism and probably finalized this function for *NIX. Need Windows testing.