adding registry and some reorganising