Added multiple counter threads and fixed race issue