finished register functionality