refactor heartbeat module