Code cleanup and 64-bit build