could probably just use idAttribute variable rather than creating another local?