Refactored to allow reuse of core test