Updated register form and added registration logic