Improvements suggested by Martin.