added exit and split conditions. -Q and -q flags