tried moving device_vectors around, but the compiler complains. left changes in commented