Added some documentation
Removed redundancy in map handling

and modified search string for increased generality