Namespacing and shortening of the shim code according to Anssi's suggestions.