Improve performance & fix .contains bug. Bug 902697.