rewrite average_fast