refactor registration and login features