reimplemented, merged file/string
updated version