minor correction: else comes before newline after if's ending brace. Coded in RStudio and didn't actually have to do the else thing so didn't pick this up earlier.