refactoring to standarize some field names and finish the login check