Create pete average function