added threaded outputting