Made some changes to support 64 bits