Moved the local memory arrays inside the kernel