Rearranged some outputs

Fixed infinite loop problem and some outputs