finally finished the array functions