Remove inefficient for-loop
Don't fail at stdout's EOF