rewrote program with threads
Merge pull request #1 from jkozlick/master

rewrote program with threads