Removed some unnecessary code and added redirect on registration page.