refactored to cor