Sorry there was a logical error and it wasn't checking R2. Now it's fixed, this illustrates the importance of debugging through outputs!