Changed threading implementation