Refactoring of id function.