Cleaned up code, added originalPar <-  par(no.readonly = TRUE) and reset to original at end. I think this will be better?