make paginator class "global" and changed db connection