added different quit condition