finish detail page function