added logic to show different detail views based on referenced object