refacroted identity code