References Issue #4

Fixed more bugs in the pagination scheme. Hopefully the last batch.