refactor core