inference function wip