udpated version of #208

cc @lancejpollard, @calvinfo updated version of #208 

i'm not able to test locally