Added toId() method