adding MAP inference