reorganizing the code and adding most of identity types