Implemented timeouts (fixes #3)