addresses #143
addresses #140 with CHH's code from #146