Integrating changes from John Chilton