fixed not using pointer but reference to array for simpler access