updated code to work off unique id