Modularized version.