Various improvements and simplifcations.