improve code for LongRunning task