Add apply_hypothesis and helper functions