registration code cleanup