Switched to .size instead of .length to prevent an error from occuring