modify to improve performance