Code from Williams studies.