improve performance by reducing queries