Added check to prevent errors when trying to call this function multiple times
Added check to prevent errors when trying to call this function multiple times