Using size cause infinite loop, use length instead