Nvidia refactoring

Compiled and tested on x86_64. See no reason why it wouldn't work on 32-bit as well.