Mweb 965

Do not merge
First thought was to extract the whole "search if" and put it to some utils function which uses `Q` and returns a promise but there are too many dependencies...  It might be possible with a utils function wrapped in an anonymous function but I'm not sure if it's worth it. It works fine right now and is still readable, I guess.