reimplement and finaly fix read-from-file