addresses #140 with CHH's code from #146