Fixed pagination issue. Moved paginate by to first line