refactor more codes and complete user registration on firebase