splitting things up a bit, and making the react helper a bit cleaner (and more functional).