rm implementation