changed usage of HashMap to LinkedHashMap to preserve insertion order