Modularized a bit.