More robust check, proper line reading.
Merge pull request #3 from shazow/master

More robust timeout, better line reading