Code cleanup and updated the patches
Added missing patch