refactored register form