- fixed a bug and added encoding for file and stream reading
- removed unneeded imports