#1179 code's less crufty but would like to add more comments