Improved ui pagination. Fixed pagination bug.