I have fixed and enhanced the part of formula calculation.
1. I have added a new setting in the Traditional tab:

Under Arabic Lot -> Part of Function you will have three choices:
This uses the same formula for every chart, regardless of the Sun's position. It is the standard used by many modern astrologers who prefer a constant mathematical relationship between the Sun and Moon.
This is the most common "Traditional" setting. It "flips" the formula if the Sun is in Houses 1 through 6
(below the horizon line). This method is easy to see at a glance on a chart wheel and is the standard in Hellenistic and Medieval astrology.
This is the most precise traditional method. Instead of looking at house numbers, it uses the
Sun's actual altitude (including the curve of the earth and light refraction) to determine if it was
technically day or night. This is ideal for "borderline" charts where the Sun is very close to the horizon line.
The most common options seem to be 'Day Only" and 'Day/Night'