added logic to transition to leader
partial append-entries logic