LOTS of rewriting and bug fixing.