64 bit changes

Please code review thoroughly