added quality as a argument