purchase pagination fix
reformat code