working single threaded code
first threaded example working