Added tree as an argument to getItemFromTree