core refactor