Added if up and down to heartbeat