Performance

A simple modification gave me 30% speed increase. Interesting for big files.
Tests are not ok, but wasn't before update.