Identity model refactured (extracted to libraries)