Run animations not displaying

I am making a top down game and I have run and idle animations for each direction but it is only displaying the idle animations (in the correct directions) and not the run animations.
This is the code that sets the animation parameters:
void Update ()
horizontal = Input.GetAxisRaw(“Horizontal”);
vertical = Input.GetAxisRaw(“Vertical”);
animator.SetBool(“isMoving”, false);
else {
animator.SetBool(“isMoving”, true);
animator.SetInteger(“direction”, 1);
else if(vertical==1){
animator.SetInteger(“direction”, 2);
else if(horizontal==-1){
animator.SetInteger(“direction”, 3);
else if(horizontal==1){
animator.SetInteger(“direction”, 4);

This is my animation tree:

The transitions to the idle animations just check if isMoving is false.

What am I doing wrong here?