LPS-41073 and LPS-41260

Based on changes suggested by Nate. See https://gist.github.com/natecavanaugh/e4575b6cfd58c77fa9b7