[mod] refactor k-core code