Fixes #5 by adding/detecting timeout