Updated and refactored core