Difficulty keeping master/detail with lists in sync

Difficulty keeping master/detail with lists in sync

  
I am trying to construct a screen which has a master/detail with lists. Both the master and detail have lists with pagination. Clicking on a link in the master list runs the refresh for the detail and attempts to show the list of detail records in the other list.

I'm having several issues:
1) When the page first comes up, it appears that the master list leaves off at the first record on it's second page (current rec) and that causes the detail list not to display records from the first master record.
2) When I click on a master record, the detail list changes fine. However, when I try to go to page two of the detail list, it thinks that a different master record is the current record and it does not display properly.

Do anyone have any advise as to how I keep the detail list in sync with the master? TIA!