trim views and handle duplicated views