refactoring of core