Code cleanup; write up.