changed the registration algoritem