after a lot of back and forth, this seems correct.