Slightly modified logic