Refactor main mod class