Corrected solution for BinaryCode