todo move in a thread