Trying to fix buggy logic.