To re-add in aaronva's changes on https://github.com/mtahmed/bayesact/commit/f9a7da14c869c6afe7e140c7f32297c6e594fe0e due to commit issues