Refactor of imessage-search