core refactored