Added a tweak to avoid unnecessary computation at the most obvious cases.