Implemented heartbeat checks and timeout option