Changed to using arrays instead of pointer math