More semaphore-related fixes.
Cosmetic: remove dangling parameter.
Remove dead code.
Port pagination code to DOM.