Simplified the code for the inference.