Adding inpaint function and changes in fmm implementation