some refactoring in inference methods: be more agnostic about rest