Cleaned up some pagination code.