Added ML functionality to code