refactor hex => bin parsing