several bug fixes. Added namespace for non-AMD usage.