Completed mod-friendly refactoring