[mod] some refactoring