kinda got thread solution working in linux