changed arrays to thrust device_vectors
refactor code