Refactoring Done.
Starting work on the add_identity function.