first implementation of binary reader