copying from dennis branch