Refactored to avoid the need to copy for mark check