moving the heartbeat middle ware up