use hashmap and hashset instead of linked. remove synchronized