Cleanup of detect return