Pagination for media gallery & a few more changes