Complete rewrote.