added tests and fixed the strides and chunking in the for loops