Some more modularizing. Still a way to go, but getting better.