Cleaned registration code up