Added code such that after determining sign of the voltage, on the magnitude of the voltage is considered - for convenience.