Complete refactor of the mod