Make use of multimap, and use of some typedefs to make it more readable
Use of type
Const optimization to avoid unnessesary copy
type use
some extra minor optimizations
Merge branch 'cleanup_cpp'