Re-design of the Mod and cleanup of the code