Removed duplicate functions from device.hpp

Hi,

I have removed instances of the duplicate functions from the existing code and did a build check. Some of the newer projects weren't compiling with visual studio, but the errors were for different reasons (most were "typename cannot be used outside a template declaration"), so I rechecked them manually. Please let me know if it breaks something.