Adding registration response message and some refactoring.