handle 64 bit cases too

Some improvements to divide code, such as handling 64 bit versions. More to come.