preprocessor optimization, unnecessary map creation removed
it used to be O(n^2), now it's only O(n)