a bunch of refactors / simplifications from live code review