Optmized a helper method.