some refactor from login form