core routine moved to __device__