changed HashMap to LinkedHashMap for ordered output generation