some improvements, add index on name