Refactoring and 64-bit support