small refactoring
skeleton for inference with hierarchy