adding loading animation

also fixed a bug in the pagination controller