beautifying the output + fixing minor bug