basic pagination and cleanup