This version uses arrays