implemented region queries

refactored similarity computation into own function for this