Added more functionality to the registration javascript