Use readline instead of fgets