Added Registry class

Remove all global calls, changed to registry calls.