implemented solution for binary files