Removed [:,...,:] from variables initialisation hoping it would fix the memory issues