Refactoring. Sorting out map and searc comunication