reading, writing and sorting large files