Replace `for` to `while`, improved type in github