integrated Tom's new changes; and some other minor editing