Optimized the datastructure with Hashmaps and arraylists