Encapsulated all calls to the CWD into a function + made the registration form work again