optimizing search
optimize query and added pagination