first function working for convertToBin