added quality function