core: refactoring