implemented avg
implemented parity