Added error handling for timeouts. Closes #5.