initial binary conversion code