superfast matching
added weight argument