I'm not a big fan of global mutable state. Is there a better way to do this?