Added from josh4trunks: simplifications.