Changed array access to pointers