registration logic