Made heartbeat timer code cleaner