Rewrite for modularity and checksum ability.