added parity function