merged toBinary.cpp into feature/Daniel