changed feature detection function to a lambda