code refactor in core module