Cleaning up code in mpaginate and app.