replaced with fgets, huge time improvement