refactored core