Fixing logic with case numbers.