added embedded identity parsing and fixed some bitwise logic in claims