Making autopaginate more flexible