Fixed min, avg, and inserting into RAM functions