treatBoundry on GPU implemented, still small functions should be freed from for loops